#include <string>
#include <sstream>
#include <iostream>

using namespace std;

void fn(int a) {
  for (int i = 0; i < 10; ++i) {
    cout << a << endl;
  }
}

int main(int argc, char const *argv[])
{
  ostringstream oss;

  int a = 10;

  // a = 10
  oss << "a = " << a;
  string expr = oss.str();

  oss.str(""); // 清空内容
  oss.clear(); // 清空状态

  oss << "b = " << a;
  string expr1 = oss.str();

  cout << expr << endl;
  cout << expr1 << endl;

  return 0;
}
